SELECT
	a.inst_id,Substr(a.username,1,15) "Username",       sql_text,       a.osuser "OS
User",       a.sid "Session ID",       	a.serial# "Serial No"  
,   a.lockwait "LockWait",       a.status "Status",
       Substr(a.machine,1,15) "Machine",       
    a.program "Program",
       Substr(To_Char(a.logon_Time,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Time",
      trunc( sysdate-a.logon_Time ) || 'Dy : ' ||	   trunc( mod(
(sysdate-a.logon_Time)*24, 24 ) ) || 'Hr : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60, 60 ) ) || 'Mi : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60*60, 60 ) ) || 'Sec' Elapsed
FROM   gv$session a,
       gv$sqlarea s
WHERE   s.address=a.SQL_ADDRESS
and a.program like '%exp%';


SELECT
	Substr(a.username,1,15) "Username",       a.osuser "OS
User",       a.sid "Session ID",       	a.serial# "Serial No"  
,   a.lockwait "LockWait",       a.status "Status",
       Substr(a.machine,1,15) "Machine",       
    a.program "Program",
       Substr(To_Char(a.logon_Time,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Time",
      trunc( sysdate-a.logon_Time ) || 'Dy : ' ||	   trunc( mod(
(sysdate-a.logon_Time)*24, 24 ) ) || 'Hr : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60, 60 ) ) || 'Mi : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60*60, 60 ) ) || 'Sec' Elapsed
FROM   v$session a
WHERE  a.program like '%exp%';



select 'kill -9 '||spid
from v$session s, v$process p
where s.paddr=p.addr
and to_number(trunc(last_call_et/60,0)) > 30
and s.status='KILLED'
/

select 'kill -9 '||spid
from v$session s, v$process p
where s.paddr=p.addr
and s.status='KILLED'
/

select s.sid,s.status,'kill -9 '||spid
from v$session s, v$process p
where s.paddr=p.addr
and s.sid in (select sid from v$session);

select s.sid,s.status,'kill -9 '||spid
from v$session s, v$process p
where s.paddr=p.addr
and s.sid in (select sid from v$session);

select s.sid,s.status,'kill -9 '||spid
from v$session s, v$process p
where s.paddr=p.addr
and s.username='SYS';


SELECT
	Substr(a.username,1,15) "Username",       a.osuser "OS
User",       a.sid "Session ID",       	a.serial# "Serial No"  
,   a.lockwait "LockWait",       a.status "Status",
       Substr(a.machine,1,15) "Machine",       
    a.program "Program",
       Substr(To_Char(a.logon_Time,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Time",
      trunc( sysdate-a.logon_Time ) || 'Dy : ' ||	   trunc( mod(
(sysdate-a.logon_Time)*24, 24 ) ) || 'Hr : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60, 60 ) ) || 'Mi : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60*60, 60 ) ) || 'Sec' Elapsed
FROM   v$session a
WHERE  a.program like '%exp%';

SELECT
	Substr(a.username,1,15) "Username",       a.osuser "OS
User",       a.sid "Session ID",       	a.serial# "Serial No"  
,   a.lockwait "LockWait",       a.status "Status",
       Substr(a.machine,1,15) "Machine",       
    a.program "Program",
       Substr(To_Char(a.logon_Time,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Time",
      trunc( sysdate-a.logon_Time ) || 'Dy : ' ||	   trunc( mod(
(sysdate-a.logon_Time)*24, 24 ) ) || 'Hr : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60, 60 ) ) || 'Mi : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60*60, 60 ) ) || 'Sec' Elapsed
FROM   v$session a
where a.username='SYS';


SELECT
	Substr(a.username,1,15) "Username",       sql_text,       a.osuser "OS
User",       a.sid "Session ID",       	a.serial# "Serial No"  
,   a.lockwait "LockWait",       a.status "Status",
       Substr(a.machine,1,15) "Machine",       
    a.program "Program",
       Substr(To_Char(a.logon_Time,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Time",
      trunc( sysdate-a.logon_Time ) || 'Dy : ' ||	   trunc( mod(
(sysdate-a.logon_Time)*24, 24 ) ) || 'Hr : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60, 60 ) ) || 'Mi : ' ||
      trunc( mod( (sysdate-a.logon_Time)*24*60*60, 60 ) ) || 'Sec' Elapsed
FROM   v$session a,
       v$sqlarea s
WHERE   s.address=a.SQL_ADDRESS
and a.username='SYS'
and sql_text like '%ALTER%';

